/*
Please Do Not use this code in c++ module.
This function is for uzing (C#)
*/

#include <Inklude/Inklude.h>
#include <Inklude/ikCTcpClient.h>
#include <Inklude/ikCString.h>
#include <Windows.h>

using namespace Inklude;

INKLUDE_C_EXPORT void* _inklude_tcp_client_create_instance()
{
    ikCTcpClientSync* pMem = new ikCTcpClientSync();
    return pMem;
}

INKLUDE_C_EXPORT void _inklude_tcp_client_initialize(void* pMem, unsigned int nRecvPort)
{
    reinterpret_cast<ikCTcpClientSync*>(pMem)->Initialize(nRecvPort);
}

INKLUDE_C_EXPORT void _inklude_tcp_client_set_distination(void* pMem, LPCWSTR Address, unsigned int nPort)
{
    ikCString addr = Address;
    reinterpret_cast<ikCTcpClientSync*>(pMem)->SetDestinationAddress(addr.c_str(), nPort);
}

INKLUDE_C_EXPORT unsigned int _inklude_tcp_client_send(void* pMem, PBYTE pBuffer, const size_t nDataSize) 
{
    return reinterpret_cast<ikCTcpClientSync*>(pMem)->Send(pBuffer, nDataSize);
}

INKLUDE_C_EXPORT unsigned int _inklude_tcp_client_receive(void* pMem, PBYTE pBuffer, const size_t nDataSize) 
{
    return reinterpret_cast<ikCTcpClientSync*>(pMem)->Receive(pBuffer, nDataSize);
}